<!-- 帮助反馈页面 -->
<template>
	<view>
		<view class="bg-list">
			<view v-for="(item,index) in helpClassifyList" class="list-title padding-bottom">
				<view class="flex align-center justify-between" @tap="openList(item,index)">
					<view class="text-title">{{item.classifyName}}</view>
					<view>
						<image src="../static/up.png" style="width: 21rpx;height: 15rpx;" v-if="item.createTime==0">
						</image>
						<image src="../static/dowm.png" style="width: 21rpx;height: 15rpx;" v-else></image>
					</view>
				</view>
				<view v-for="(problemItem,problemIndex) in item.articleList" :key="problemIndex" class="list-question"
					hover-class="hover" @tap="onClick(problemItem)" v-if="item.createTime==0">
					<view class="text-item">{{problemIndex + 1}}，{{problemItem.title}}</view>
					<view class="line" v-if="problemIndex!=item.articleList.length-1"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				helpClassifyList: []
			}
		},
		onLoad() {
			this.getlist()
		},
		methods: {
			openList(item,index) {
				var oldhelpClassifyList = item
				if (oldhelpClassifyList.createTime == 1) {
					this.getIdByList(item.id,index);
				} else {
					item.createTime = 1
				}
				console.log(item.createTime)
			},
			getlist() {
				this.$Request.getT("/article/selectArticleClassifyList").then(res => {
					if (res.status == 0) {
						this.helpClassifyList = res.data
						for (var i = 0; i < this.helpClassifyList.length; i++) {
							this.helpClassifyList[i].createTime = 1
						}

					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				});
			},
			getIdByList(classifyId,index){
				this.$Request.getT("/article/selectArticleList?classifyId=" + classifyId+'&page=0&size=50').then(res => {
					if (res.status == 0) {
						this.helpClassifyList[index].articleList = res.data.content;
						this.helpClassifyList[index].createTime = 0;
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				});
			},
			onClick(item) {
				uni.navigateTo({
					url: './helpDetail?title=' + item.remark + '&helpWordId=' + item.id,
				})
			},
		}
	}
</script>

<style>
	page {
		background-color: #FFFFFF;
		height: 100%;
	}

	.bg-box {
		background-color: #FFFFFF;
		position: fixed;
		bottom: 0;
		left: 0;
		right: 0;
	}

	.bg-list {
		margin-bottom: 100rpx;
		background-color: #FFFFFF;
		padding: 30rpx
	}

	.bg-white-box {
		background-color: #F7F7F7;
		margin: 30rpx;
		display: flex;
		flex-direction: row;
		justify-content: center;
		align-items: center;
		padding: 10rpx;
		border-radius: 20rpx;
		color: #000;
		font-size: 32rpx;
	}

	.vertical-line {
		height: 20rpx;
		background-color: #cecece;
		width: 2rpx;
		margin-left: 30rpx;
		margin-right: 30rpx;
	}

	.line {
		width: 100%;
		height: 1rpx;
		background-color: #d3d3d3;
	}



	.text-title {
		color: #000;
		font-size: 32rpx;
		font-weight: bold;
	}

	.text-item {
		color: #999999;
		font-size: 28rpx;
		padding: 24rpx 0rpx;
	}

	.list-title {
		margin-bottom: 30rpx;
	}

	.list-question {
		color: #000;
		font-size: 28rpx;
	}

	.hover {
		background-color: #ffffff;
		opacity: 0.6;
	}

	.image {
		width: 40rpx;
		height: 40rpx;
		margin-left: 20rpx;
	}

	.text-feedback {
		padding: 20rpx;
		/* color: #000000; */
	}

	.text-top {
		margin: 30rpx;
		color: #000;
		font-size: 34rpx;
	}
</style>
